package edu.ped.android.nfc;

import java.util.ArrayList;
import java.util.List;

import edu.ped.android.utils.NFCUtil;
import greendroid.app.GDListActivity;
import greendroid.widget.ActionBarItem;
import greendroid.widget.ItemAdapter;
import greendroid.widget.item.Item;
import greendroid.widget.item.ThumbnailItem;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

public class GestureActivities extends GDListActivity {

	String[] names = new String[3];
	Drawable[] icons = new Drawable[names.length];
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);


		/*Title Bar*/
		ActionBarManager.initActionBar(this,ActionBarManager.GESTURES);

		List<Item> items = new ArrayList<Item>();
		items.add(new ThumbnailItem(getResources().getString(R.string.manage), getResources().getString(R.string.managedesc), R.drawable.manage));
		items.add(new ThumbnailItem(getResources().getString(R.string.launch), getResources().getString(R.string.rundesc), R.drawable.run));
		
		final ItemAdapter adapter = new ItemAdapter(this, items);
		setListAdapter(adapter);
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Intent intent;
		if(position == 0){
			intent = new Intent(this,ShowRulesActivity.class);
			this.startActivity(intent);
		}
		else if(position == 1){
			intent = new Intent(this,GestureActivity.class);
			this.startActivity(intent);
		}
	}

	@Override
	public boolean onHandleActionBarItemClick(ActionBarItem item, int position) {
		 if(!ActionBarManager.handleActionBar(this, item, position))
			 return super.onHandleActionBarItemClick(item, position);
		 return true;
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		NFCUtil.getNFCFocus(this);
	}
}

